<!--
  ~ This program is part of the OpenLMIS logistics management information system platform software.
  ~ Copyright © 2013 VillageReach
  ~
  ~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  ~  
  ~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
  ~ You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org. 
  -->

<ng-include src="'/public/pages/logistics/rnr/partials/header.html'"></ng-include>
<div class="rnr-tabs clearfix">
    <ul class="clearfix">
        <li ng-class="{'selected': (visibleTab == 'fullSupply' || visibleTab == undefined), 'has-error': fullSupplyTabError}">
            <a href="" ng-click="switchSupplyType('fullSupply')" id="fullSupplyTab"
               openlmis-message="label.full.supply.products"></a></li>
        <li  ng-show="rnr.program.showNonFullSupplyTab" ng-class="{'selected': visibleTab == 'nonFullSupply', 'has-error': nonFullSupplyTabError}">
            <a href="" ng-click="switchSupplyType('nonFullSupply')" id="nonFullSupplyTab"
               openlmis-message="label.non.full.supply.products"></a></li>
        <li ng-class="{'selected': visibleTab == 'regimen'}" ng-show="regimenCount">
            <a href="" ng-click="switchSupplyType('regimen')" id="regimenTab" openlmis-message="label.regimens"></a>
        </li>
        <li ng-class="{'selected': visibleTab == 'equipment'}" ng-show="equipmentCount">
          <a href="" ng-click="switchSupplyType('equipment')" id="equipmentTab" openlmis-message="label.equipments"></a>
        </li>
    </ul>
  <span class="pull-right">
    <a id="resizeViewButton" full-screen href="" class="btn">
      <i class="icon-resize-full"></i>
    </a>
  </span>
  <span class="pull-right print-button">
    <a id="printButton" class="btn btn-primary" ng-href="/requisitions/{{rnr.id}}/print.pdf"
       openlmis-message="button.print"
       target="_blank"></a>
  </span>
</div>

<form name="approvalForm" novalidate>

  <span ng-show="visibleTab === 'nonFullSupply'">
    <ng-include src="'/public/pages/logistics/rnr/partials/approve/approve-non-full-supply.html'"></ng-include>
  </span>
  <span ng-show="visibleTab === 'regimen'">
    <ng-include src="'/public/pages/logistics/rnr/partials/approve/approve-regimen-line-item.html'"></ng-include>
  </span>
  <span ng-show="visibleTab === 'fullSupply'">
    <ng-include src="'/public/pages/logistics/rnr/partials/approve/approve-full-supply.html'"></ng-include>
  </span>
  <span ng-show="visibleTab === 'equipment'">
    <ng-include src="'/public/pages/logistics/rnr/partials/approve/approve-equipment-line-item.html'"></ng-include>
  </span>
  <div ng-hide="visibleTab === 'regimen'">
        <openlmis-pagination num-pages="numberOfPages" current-page="currentPage" max-size="10"
                             check-error-on-page="checkErrorOnPage(page)"></openlmis-pagination>
    </div>

  <br><br>

  <div form-toolbar id="action_buttons" class="action-buttons">
    <ng-include src="'/public/pages/logistics/rnr/partials/total-cost.html'"></ng-include>

        <div class="form-cell button-row">
          <input ng-show="rnr.status != 'SKIPPED' && rnr.status != 'RELEASED'" type="button" class="btn btn-primary submit-button" ng-click="rejectRnR();" openlmis-message="button.rnr.reject" />

            <input id="saveButton" type="button" openlmis-message="button.save" ng-click="saveRnr()"
                   class="btn btn-primary save-button"
                   ng-disabled="!canApproveRnr"/>
          <input id="approveButton" type="button" ng-click="approveRnr()" class="btn btn-primary submit-button"
                 openlmis-message="button.approve"
                 ng-disabled="!canApproveRnr"/>
          <input ng-class="{'btn-warning': rnrComments.length}" id="comments" type="button" ng-click="showCommentBox=!showCommentBox" class="btn comments-button"
                   openlmis-message="comments.header"/>
            <comment-box updatable="true" show="showCommentBox"></comment-box>
        </div>
        <div class="toolbar-error" id="saveFailMessage" openlmis-message="error" ng-show="error"></div>
        <div class="toolbar-success" id="saveSuccessMsgDiv" ng-show="message" fade-out="3000"
             openlmis-message="message"></div>
    </div>
</form>
